﻿namespace EFS.RC.CC.Messages.Agents
{
	/// Used for the statuses message list
	public class StatusList : EFS.RC.CC.Messages.MessageCollection<EFS.RC.CC.Messages.Agents.Status>
	{
		/// Public constructor (used especially for deserialization)
		public StatusList()
			: base()
		{
		}

		/// Explicit constructor
		public StatusList(EFS.RC.CC.Messages.Agents.Status[] items)
			: base(items)
		{
		}

		/// Explicit constructor
		public StatusList(System.Collections.Generic.ICollection<EFS.RC.CC.Messages.Agents.Status> collection)
			: base(collection)
		{
		}

		/// Filter using the given arguments
		public EFS.RC.CC.Messages.Agents.Status[] Filter(
			System.String sip,
			System.Boolean? isOnline,
			System.Boolean? inSession,
			System.Boolean? inWrap,
			System.Boolean? isAvailable,
			System.Int32? skillID,
			System.Boolean acdInclude,
			System.String acdMatch)
		{
			// create list
			System.Collections.Generic.List<EFS.RC.CC.Messages.Agents.Status> retValue =
				new System.Collections.Generic.List<EFS.RC.CC.Messages.Agents.Status>();

			// cicle all
			foreach (EFS.RC.CC.Messages.Agents.Status agentStatus in Items)
			{
				if (agentStatus.CheckACD(sip, isOnline, inSession, inWrap, isAvailable, skillID, acdInclude, acdMatch))
				{
					retValue.Add(agentStatus);
				}
			}

			// ok
			return retValue.ToArray();
		}
	}

}